home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FPGAWKII.ZIP / COUNTER.PDS < prev    next >
Text File  |  1994-10-05  |  1KB  |  33 lines

  1. ;---------------------------------------------------------
  2. ; Now we'll use the combinational incrementer module to
  3. ; build a resetable counter.
  4. ;---------------------------------------------------------
  5. CHIP    cntr    NFX780_84
  6.  
  7. PIN 47      clock    ;* the clock for the entire circuit
  8. PIN 48      reset    ;* resets the counter to 0
  9. PIN         cnt[0:2] ;* the output of the counter
  10. PIN         nxt[0:2] ;* the next state of the counter
  11. PIN [34:37] s[0:3]   ;* LED segment drivers
  12. PIN [39:41] s[4:6]   ;* LED segment drivers
  13.  
  14. MODULE incrmntr( rst=reset, cur[0:2]=cnt[0:2],
  15.                           nxt[0:2]=nxt[0:2] )
  16. MODULE leddigit( d[0:2]=cnt[0:2], d3=GND, s[0:6]=s[0:6] )
  17.  
  18. EQUATIONS
  19.         cnt[0:2] := nxt[0:2]   ;* next state becomes
  20.         cnt[0:2].ACLK = clock  ;* curr. state on pos. clk
  21.  
  22. SIMULATION
  23.         VECTOR cnt := [cnt2,cnt1,cnt0]
  24.         TRACE_ON clock cnt
  25.         SETF /clock   ;* set the clock low to start
  26.         SETF reset    ;* activate the reset input
  27.         CLOCKF clock  ;* clock the counter to reset it
  28.         SETF /reset   ;* deactivate the reset
  29.         for i:=0 TO 20 DO
  30.                 BEGIN
  31.                 CLOCKF clock
  32.                 END
  33.